package com.cqjtu.education.utils;

import cn.dev33.satoken.stp.StpInterface;
import com.cqjtu.education.dao.UserDao;
import com.cqjtu.education.entity.User;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;

/**
 * @Author: 冉鹏
 * @Date: 2022/4/8 15:18
 */
@Component
public class StpInterfaceImpl implements StpInterface {
    @Resource
    UserDao userDao;
    /**
     * 返回一个账号所拥有的权限码集合
     */
    @Override
    public List<String> getPermissionList(Object loginId, String loginType) {
        return null;
    }

    /**
     * 返回一个账号所拥有的角色标识集合 (权限与角色可分开校验)
     */
    @Override
    public List<String> getRoleList(Object loginId, String loginType) {
        List<String> list = new ArrayList<>();
        User user=userDao.queryById(loginId.toString());
        list.add(user.getRole());
        return list;
    }
}
